import Link from "../../api/Link.js";
import apiurl from "../../api/url.js";

let HomeMoudule: object = {
    state: {
        navBool: false,
        dialogFormVisible: false,
        uplistData: {},
        listdata: [],
        visible: false,
        dellistdata: {},
        addlistdata:false,
        addlistData: {},

    },
    getters: {
    },
    mutations: {
        SET_NAVBOOL(state: any) {
            state.navBool = !state.navBool
        },
        DIALOG(state: any) {
            state.dialogFormVisible = !state.dialogFormVisible
        },
        ADD(state: any) {
            state.addlistdata = !state.addlistdata
        },
        LISTDATA(state: any, paylog: any) {
            state.listdata = paylog
        },
        DLE(state: any) {
            state.visible = !state.visible
        },
        SET_DIALOG(state: any, paylog: any) {
            state.dialogFormVisible = !state.dialogFormVisible,
            state.uplistData = paylog
        },
        SET_DEL(state: any, paylog: any) {
            state.visible = !state.visible,
            state.dellistdata = paylog
        },
        SET_ADD(state: any) {
            state.addlistdata = !state.addlistdata
        },
    },
    actions: {
        USERUPDATA_LIST(context: any) {
            Link(apiurl.userlist).then((ok: any) => {
                console.log(ok)
                context.commit("LISTDATA", ok.data)
            })
        },
    }
}

export default HomeMoudule